package com.example.demo.springboot.controller;

import com.example.demo.springboot.component.JavamailComponent;
import com.example.demo.springboot.config.UserConfiguration;
import com.example.demo.springboot.entity.User;
import com.example.demo.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class UserController {


    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(UserConfiguration.class);
        UserService userService = context.getBean(UserService.class);
        for(User user : userService.query()){
//            user.log();
        }
        JavamailComponent javamailComponent = context.getBean("javamailComponent", JavamailComponent.class);
        javamailComponent.mailPrototeries();
        //销毁
        context.destroy();
    }
}
